package com.example.hangzhou.welbeing.mytestdemoapp.designPatterns.ObserverModel.FirstModel;

import com.example.hangzhou.welbeing.mytestdemoapp.designPatterns.ObserverModel.FirstInter.FirstObserver;

import java.util.ArrayList;
import java.util.List;

/**
 * 杭州惟君医疗科技有限公司15
 * Created by 20433 on 2018/5/18
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class FirstSubject {
    private List<FirstObserver> mlist = new ArrayList();

    private String mstr;

    public String getMstr() {
        return mstr;
    }

    public void setMstr(String mstr) {
        this.mstr = mstr;
        notifyall(mstr);
    }

    public void attren(FirstObserver mFirstObserver){
        mlist.add(mFirstObserver);
    }
    public void  notifyall(String mstr){
        for (FirstObserver firstObserver : mlist) {
            firstObserver.update(mstr);
        }
    }
}
